home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / quicktime / capturing / digitizershell / macframework.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  4.0 KB  |  144 lines

  1. /*
  2.     File:        MacFramework.h
  3.  
  4.     Contains:    Basic Macintosh Functions for window, menu handling and similar things for the 
  5.                 SG/vdig environment.
  6.  
  7.     Written by:     
  8.  
  9.     Copyright:    Copyright © 1994-1999 by Apple Computer, Inc., All Rights Reserved.
  10.  
  11.                 You may incorporate this Apple sample source code into your program(s) without
  12.                 restriction. This Apple sample source code has been provided "AS IS" and the
  13.                 responsibility for its operation is yours. You are not permitted to redistribute
  14.                 this Apple sample source code as "Apple sample source code" after having made
  15.                 changes. If you're going to re-distribute the source, we require that you make
  16.                 it clear in the source that the code was descended from Apple sample source
  17.                 code, but that you've made changes.
  18.  
  19.     Change History (most recent first):
  20.                 7/28/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  21.                 
  22.  
  23. */
  24.  
  25. #pragma once
  26.  
  27.  
  28. // INCLUDES
  29. #include <Movies.h>
  30. #include <QuickTimeComponents.h>
  31. #include <TextUtils.h>
  32. #include <Memory.h>
  33.  
  34. #include <stdio.h>
  35.  
  36. #ifdef __MWERKS__
  37. #include <sioux.h>
  38. #endif // __MWERKS__
  39.  
  40.  
  41. // ENUMS, DEFINES AND GLOBALS
  42. enum         {  kMovieControllerObject  = 'MCOb'
  43.              };
  44.  
  45.  
  46.  
  47. // ENUMS 
  48. // MENUS
  49. enum eMenubar { mMenubar = 128};
  50.  
  51. enum eMainMenus {
  52.     mApple = 128, mFile, mEdit
  53. };
  54.  
  55. enum  eAppleMenu {
  56.     iAbout = 1
  57. };
  58.  
  59. enum   eFileMenu{
  60.     iNew = 1, iClose, iQuit = 4
  61. };
  62.  
  63. enum eEditMenu {
  64.     iUndo = 1, iCut = 3, iCopy, iPaste, iClear, iSelectAll = 8
  65. };
  66.  
  67. // DIALOGS
  68. enum eDialogs {
  69.     kAboutBox = 128, kAlertError = 129
  70. };
  71.  
  72.  
  73. // TYPEDEFS AND STRUCTURES
  74. // WindowObjectRecord/Ptr is a data structure attached to the movie window. Use
  75. // this structure if you want to associate any data with any window presented.
  76.  
  77. typedef struct {
  78.     OSType                    ObjectType;                        // specific tag indicating that the window object belongs to our application
  79.     MovieController     controller;
  80.     Rect                        originalSize;                    // including movie controller
  81.     FSSpec                    FileFSSpec;
  82.     short                    FileResID;
  83.     short                    FileRefNum;
  84.     
  85. // add more elements if needed
  86. } WindowObjectRecord, *WindowObjectPtr, **WindowObject;
  87.  
  88. // SG specific data structures
  89.  
  90. typedef struct {
  91.     SeqGrabComponent     sg;
  92.     SGChannel                    videoChannel;
  93.     SGChannel                    soundChannel;
  94.     WindowPtr                sgWindow;
  95. } SGResourceRecord, *SGResourcePtr, **SGResourceHndl;
  96.  
  97.  
  98. // FUNCTION PROTOTYPES
  99.  
  100. // PURE MAC TOOLBOX FUNCTIONS
  101. void                            InitStack(long extraStackSpace);
  102. void                             InitMacEnvironment(long nMoreMasters);
  103.  
  104. Boolean                     InitMenubar(void);
  105. void                             HandleMenuCommand(long theMenuResult);
  106. void                             AdjustMenus(void);
  107. void                             MainEventLoop(void);
  108.  
  109. Boolean                     IsAppWindow(WindowRef theWindow);
  110. WindowObject             CreateWindowObject(WindowRef theWindow);
  111.  
  112. void                             HandleKeyPress(EventRecord *theEvent);
  113. void                             ShowAboutDialogBox(void);
  114. void                             ShowWarning(Str255 theMessage, OSErr theErr);
  115.  
  116. void                             DoDestroyMovieWindow(WindowRef theWindow);
  117. void                             DoActivateWindow(WindowRef theWindow, Boolean becomingActive);
  118.  
  119.  
  120. // APPLICATION SPECIFIC FUNCTIONS
  121. // These are placed in the MacApplication.c file, you could override these for changing
  122. // the behavior of the function in a specific application.
  123.  
  124. void                            DoIdle(WindowRef theWindow);
  125. void                            DoUpdateWindow(WindowRef theWindow, Rect *theRefrehArea);
  126. void                             DoCloseWindow(WindowRef theWindow);
  127. void                            DoDragWindow(WindowRef theWindow, EventRecord *theEvent);
  128. void                             HandleContentClick(WindowRef theWindow, EventRecord *theEvent);
  129. WindowRef                 CreateMovieWindow(Rect *theRect, Str255 theTitle);
  130. void                             HandleApplicationMenu(short theMenuID, short theMenuItem);
  131. void                            AdjustApplicationMenus(void);
  132.  
  133. // These are very specific sequence grabber and vdig functions used from the actual
  134. // application level.
  135. void                            CreateSGEnviroment(void);
  136. SeqGrabComponent    GetDefaultSGInstance(void);
  137. SGChannel                    GetDefaultVideoChannel(void);
  138. SGChannel                    GetDefaultAudioChannel(void);
  139.  
  140. pascal ComponentResult SpecialGrabFrameComplete(SGChannel c, short bufferNum,
  141.                                                                                 Boolean *done, long refCon);
  142. OSErr SetupVideoBottleNecks(SGChannel videoChannel, WindowPtr theWindow, CGrafPtr tempPort);
  143.  
  144.